% Sets and Parameters set of int: NO; set of int: LI; set of int: PRO_N; set of int: PR_N; set of int: RE_N; set of int: DA_T; set of int: FU_F; array[LI] of int: l_s_n; array[LI] of int: l_t_n; array[FU_F] of set of DA_T: f_i_t; array[FU_F] of set of DA_T: f_o_t; array[PRO_N] of DA_T: p_n_d; array[RE_N] of set of DA_T: r_n_d; set of int: r_n_d_l; array[NO] of DA_T: n_d; array[NO] of set of LI: n_en_l; array[NO] of set of LI: n_e_l; array[LI] of float: l_t; array[NO] of float: p_n_p; array[NO] of float: p_n_m_s; array[DA_T] of float: d_q_t_o_p; array[FU_F] of float: f_r_p; array[FU_F] of float: f_r_m_s; float: t_d_w; float: m_d_w; float: l_u_w; float: typeD_upper_bound; % Decision Variables array[DA_T,LI] of var 0..1: typeIsT::add_to_output ; % Intermediate Variables array[NO,DA_T] of var 0..1: typeIsC::add_to_output ; array[PR_N,DA_T] of var 0..1: typeIsP::add_to_output ; array[NO,DA_T] of var 0..1: typeIsA::add_to_output ; array[NO,DA_T] of var 0.0..typeD_upper_bound: typeD::add_to_output ; % Constraints % 1- constraint forall(s in PRO_N)( typeIsA[s,n_d[s]] = 1 /\ sum( t in DA_T where t != n_d[s])(typeIsA[s,t]) = 0); % 2- constraint forall(n in PR_N, t in DA_T)(typeIsA[n,t] = max(typeIsC[n,t], typeIsP[n,t]) /\ (typeIsC[n,t] + typeIsP[n,t] <= 1)); % 3- constraint forall(h in RE_N, t in DA_T where t in r_n_d[h])(typeIsA[h,t] = 1 /\ typeIsC[h,t] = 1); % 4- constraint forall(n in PRO_N union PR_N, t in DA_T )( typeIsA[n,t] = 0 -> sum(l in n_e_l[n])(typeIsT[t,l]) = 0 ); %6- constraint forall( l in LI where l_t_n[l] in PR_N, t in r_n_d_l)( typeIsT[t,l] = 1 -> (sum(li in n_e_l[l_t_n[l]])(typeIsT[t,li]) >= 1)); % 7- constraint forall(n in PR_N union RE_N, t in DA_T)(typeIsC[n,t] = sum(l in n_en_l[n])(typeIsT[t,l])); % 10- constraint forall(t in DA_T, f in FU_F where t in f_o_t[f])(sum(n in PR_N)(typeIsP[n,t]) = 1); % 12- constraint forall(s in PRO_N, t in DA_T where t = p_n_d[s])(typeD[s,t] = 0.0); % 13- constraint forall(n in PR_N, t in DA_T, f in FU_F where t in f_o_t[f] /\ typeIsP[n,t] = 1) ( let { var float: processing_time = (f_r_p[f] / p_n_p[n]); var float: memory_time = (f_r_m_s[f]/p_n_m_s[n]); } in typeD[n, t] = max(tau in f_i_t[f])(typeD[n, tau]) + processing_time + memory_time ); % 14- constraint forall(n in PR_N union RE_N, t in DA_T, l in n_en_l[n]) (typeIsT[t,l] = 1 -> ( let { var float: transmission_time =(d_q_t_o_p[t]/l_t[l]) } in typeD[n,t] = typeD[l_s_n[l],t] + transmission_time)); % 15- constraint forall(n in NO, t in DA_T where typeIsA[n,t] = 0 )( typeD[n,t]=0.0); % Objectives var float: n_a_d ::add_to_output = sum(h in RE_N, t in r_n_d[h])(typeD[h,t]); var float: n_m_d ::add_to_output= max(h in RE_N, t in r_n_d[h])(typeD[h,t]); var float: l_us :: add_to_output = sum(l in LI, t in DA_T)( typeIsT[t, l] * ( (d_q_t_o_p[t] / l_t[l]) ) ) / card(LI); %Weighted objective function var float: objective_func = t_d_w*n_a_d + m_d_w*n_m_d + l_u_w*l_us; solve minimize objective_func;